/**  
 * @author renbangjie renbangjie@126.com  
 * @date 2016-6-30 下午3:28:48
 * @version V1.0  
 * <b>Copyright (c)</b> 2014医信金融信息服务（上海）有限公司-版权所有<br/>
 */
package com.yjd.bi.comm.utils;

import org.apache.commons.lang3.StringUtils;

import com.yjd.comm.util.FrameUtil;

/**
 * @author renbangjie renbangjie@126.com
 * @date 2016-6-30 下午3:28:48
 */
public class DbNameUtils {

	private static final String DB_CONF = "db";

	public static String get(String tableName) {
		String dbName = FrameUtil.getResourceByFile(DB_CONF, tableName);
		if (StringUtils.isBlank(dbName)) {
			return "`" + tableName + "`";
		}
		StringBuilder sb = new StringBuilder();
		sb.append("`");
		sb.append(dbName);
		sb.append("`");
		sb.append(".");
		sb.append("`");
		sb.append(tableName);
		sb.append("`");
		return sb.toString();
	}

}
